package com.example.swordjava;


import java.util.HashMap;
import java.util.Map;

public class Test56 {

    public static void main(String[] args) {

        int[][] a = {{1, 2, 3, 4},
                {5, 6, 7, 8},
                {9, 10, 11, 12},
                {13, 14, 15, 16}};

        System.out.println(Math.pow(1, 10));

    }

    public class TreeNode {
        int val = 0;
        Test45.TreeNode left = null;
        Test45.TreeNode right = null;

        public TreeNode(int val) {
            this.val = val;

        }
    }

    /**
     * 数组中只出现一次的两个数字
     * 一个整型数组里除了两个数字只出现一次，其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。
     */

    public int[] FindNumsAppearOnce(int[] nums) {
        // write code here
        int[] res = new int[2];
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if (map.containsKey(nums[i])) {
                map.put(nums[i], 2);
            } else {
                map.put(nums[i], 1);
            }
        }

        int i = 0;
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            if (entry.getValue() == 1) {
                res[i] = entry.getKey();
                i++;
            }
        }
        return res;
    }

}














